{% extends "configurarFaseLayout.html" %}
{% block subbodyfase %}
<script>
	function add() {
		window.location.href = "agregarItemLb?filtro=" + document.form.filtro.value +"&idfase="+ document.form.idfase.value+"&idlineabase="+ document.form.idlineabase.value;
	}
	function del() {
		var valor;
		var filtro = document.form.filtro.value;
		if (document.form.check.value != null && document.form.check.checked) {
			valor = document.form.check.value;
		} else {
			for (i = 0; i < document.form.check.length; i++) {
				if (document.form.check[i].checked) {
					valor = document.form.check[i].value;
				}
			}
		}
		if (valor != null) {
			if(confirm("Está seguro que desea eliminar este item de la linea base?")){
				window.location.href = "eliminarItemLb?idlineabase=" + document.form.idlineabase.value
				+ "&filtro=" + filtro +"&idfase="+ document.form.idfase.value+"&iditem="+ valor;
			}
						
		} else {
			alert('Seleccionar un item');
		}
	}
</script>
<center><div class=titulorojo>MODIFICAR LINEA BASE</div>
<br>
<br>
	<form id="form" name="form" action="modificarLineaBase" method="post">
		<table>
			<input type="hidden" name="filtro" value="{{ filtro }}">
			<input type="hidden" name="idfase" value="{{ idfase }}">
			<input type="hidden" name="idlineabase" value="{{ lineaBase.idlineabase }}">
			<tr>
				<td class=titulochico>Observacion</td>
				<td><input name="observacion" type="text" disabled="disabled" value="{{ lineaBase.observacion }}"></td>
			</tr>
			<tr>
				<td class=titulochico>Estado</td>
				<td><input name="estadolb" type="text" disabled="disabled" value="{{ lineaBase.estadoLB.nombre }}"></td>
			</tr>
		</table>
		<table>
			<tr>
			
					{% if '00035' in session["permisos"] %}
				<td><button type="button" onclick="add()">
							<img src="{{ url_for('static', filename='add.png') }}">
						</button></td>
						{% endif %}
					{% if '00036' in session["permisos"] %}
				<td><button type="button" onclick="del()">
							<img src="{{ url_for('static', filename='delete.png') }}">
						</button></td>
						{% endif %}
			</tr>
		</table>
		<table id="items" name="items" border=1 cellpadding=2
			cellspacing=1 width=70% align=center bgcolor=#E5E5E5>
			<tr>
				<th class=titulochico width='10%'>Numero de Item</th>
				<th class=titulochico width='20%'>Nombre</th>
				<th class=titulochico width='20%'>Costo</th>
				<th class=titulochico width='20%'>Estado</th>
				<th class=titulochico width='10%'>Marcar</th>
			</tr>
			{% for item in items : %}
			<tr>
				<td align=center>{{ item.numeroitem }}</td>
				<td align=center>{{ item.nombre }}</td>
				<td align=center>{{ item.costo }}</td>
				<td align=center>{{ item.estadoItem.nombre }}</td>
				<td align=center><input type="radio" name="check"
					value="{{ item.iditem }}"></td>
			</tr>
			{% endfor %}
		<br>
		</table>
		<table>
			<tr>
				<td></td>
				<td><input name="aceptar" value="Aceptar" type="button" onClick="location.href='abmLineaBase?filtro={{ filtro }}&idfase={{ idfase }}'"></td>
			</tr>
		</table>
	</form>
</center>
{% endblock %}
